package com.hmdp.dto;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.List;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class Result<T> implements Serializable {
    private Boolean success;
    private String errorMsg;
    private T data;
    private Long total;

    public static<T> Result<T> ok(T object){
        return new Result<T>(true, null, object, null);
    }

    public static<T> Result<T> fail(String errorMsg){
        return new Result(false, errorMsg, null, null);
    }
}
